package reviewAlgorithms.dynamicProgramming;

public class MinimumDistance {
    public static void main(String[] args) {

    }
    public static int minimumDistance(String word) {
        if (word == null || word.length() <= 2){
            return 0;
        }
        Character list1 = word.charAt(0);
        Character list2 ;
        int min = Integer.MAX_VALUE;
        for (int i = 1; i < word.length(); i++) {
            list2 = word.charAt(i);
            min = Math.min(min,getRes(list1,list2,word,i));
        }
        return min;
    }

    private static int getRes(Character list1, Character list2, String word, int i) {
        int count = 0;
        for (int j = 2; j < word.length(); j++) {
            if (j == i){
                continue;
            }
            int dis1 = getDistance(list1,word.charAt(j));
            int dis2 = getDistance(list2,word.charAt(j));
            if (dis1 <= dis2){
                count += dis1;
                list1 = word.charAt(i);
            }else {
                count += dis2;
                list2 = word.charAt(i);
            }
        }
        return count;
    }

    private static int getDistance(Character character1, Character character2) {
        return 0;
    }
}
